package evaluation;
import weka.classifiers.Classifier;
import weka.core.Instances;
import weka.classifiers.Evaluation;


public class Measure {

	private Evaluation eval = null;
	private Instances testset = null;
	
	public Measure(Instances testset) throws Exception{
		this.eval = new Evaluation(testset);
		this.testset = testset;
	}
	
	public void evaluate(Classifier classifier) throws Exception{
		eval.evaluateModel(classifier, testset);
		System.out.println(eval.toSummaryString("\nResults\n======\n", false));
		// Print the confusion matrix
		System.out.println(eval.toMatrixString());
		// Print the percentage for each class
		System.out.println(eval.toClassDetailsString());
	}
	
}
